<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        var array1 = ['a','b']
       
        //增
        array1.push('push')
        array1.unshift('unshift')

        //合并数组
        var array2 = ['x','y']
        //不会改变array1和array2，一下两种方法是等效的
        var array3 = array1.concat(array2)
        var array4 = [...array1,...array1]

        //删
        // console.log(array4)
        //尾部删除
        var res4 = array4.pop()
        // console.log(`pop方法的返回值${res4}`)
        // console.log(array4)
        //头部删除
        var res5 = array4.shift()
        // console.log(`shift方法的返回值${res5}`)
        // console.log(array4)

       
        //splice()：范围删除*（ 改变原数组）*。
        var array6 = ['a','b','c','d','e']
        //实现中间删除
        //array6.splice(1,2)
        //console.log(array6)
        //实现修改
        //array6.splice(1,1,'x','y','z')
        //array6.splice(2,0,'x','y')
        //splice(startNum,deleCount,插入的内容)
        array6.splice(2,0,['x','y'],'z')


    </script>
</body>
</html>